package com.beerq.view_manager;

import android.content.Context;

import com.alibaba.fastjson.JSONObject;
import com.beerq.util.Constants;
import com.tencent.mm.opensdk.modelpay.PayReq;

/**
 * 微信和支付宝支付的管理类
 * 作者：minj on 2017/10/8 13:56
 */
public class PayManager {

    public static void doStartWechatPay(Context context,JSONObject jr){

        String payId=jr.getString("PrepayId");
        if("".equals(payId)){
            return;
        }

        PayReq request = new PayReq();
        request.appId =Constants.wx_appId;
        request.partnerId =jr.getString("PartnerId");
        request.prepayId= payId;
        request.packageValue ="Sign=WXPay";
        request.nonceStr=jr.getString("NonceStr");
        request.timeStamp= jr.getString("TimeStamp");
        request.sign= jr.getString("Sign");

        Constants.getWXAPI(context).sendReq(request);
    }
}
